
import java.awt.geom.Point2D;

public class Point extends Point2D implements Comparable<Point> {

    protected double x, y;

    public Point(double x, double y) {
        this.x = x;
        this.y = y;
    }

    public double getX() {
        return this.x;
    }

    public double getY() {
        return this.y;
    }

    public void setLocation(double arg0, double arg1) {
        this.x = arg0;
        this.y = arg1;
    }
    
    public int compareTo(Point other) {
        if (other.y < this.y || (1E-4 > Math.abs(other.y - this.y) && other.x > this.x)) {
            return 1;
        } else if (other.y > this.y || (other.y == this.y && other.x < this.x)) {
            return -1;
        } else {
            return 0;
        }

    }

    public String toString() {
        return "(" + String.format("%.2f", this.x) + ", " + String.format("%.2f", this.y) + ")";
    }
}
